package com.cskaoyan;

import com.cskaoyan.method.factory.Animal;
import com.cskaoyan.method.factory.Pig;
import com.cskaoyan.method.factory.PigFactory;
import org.junit.Test;

/**
 * 工厂方法
 * @author stone
 * @date 2021/12/23 11:34
 */
public class MyTest2 {

    @Test
    public void mytest1() {
        //通过工厂方法获得实例 →
        PigFactory pigFactory = new PigFactory();
        Animal animal = pigFactory.create();
        System.out.println(animal instanceof Pig);
    }
}
